﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="adminNewClass.aspx.cs" Inherits="Admin_adminNewClass" %>

<%@ Register Src="adminfoot.ascx" TagName="adminfoot" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <link rel="stylesheet" href="imgs/admin.css" type="text/css" media="all" />
    <script type="text/javascript" src="../DotNet_net/js/jquery-1.3.2.min.js"></script>
     <script type="text/javascript" src="imgs/GetAjax.js"></script>
    <script type="text/javascript" src="../DotNet_net/js/common.js"></script>
</head>
<body onload='$("#loading").hide()'>
<form id="form1" runat="server">   
<div class="container" id="cpcontainer">
<div id="loading" style="display:block" >   
    <div class="loading-indicator">   
        页面正在加载中...   
    </div>   
</div>
        <table class="tb2">
     <tr class="thead"><th colspan="7">
         新闻类别管理(<font color='red'>＊</font>为必填,其它选填)</th></tr>	
    <tr align="center">
		<td align="left" width="20%" style="height: 18px">ID.分类名称(产品数量)</td>
		<td width="14%" style="height: 18px">类别名</td>
		<td width="10%" style="height: 18px">别名(标签)</td>
        <td width="16%" style="height: 18px">类别简述</td>
		<td width="13%" style="height: 18px">&nbsp;操作</td>		
    </tr>
    </table>
    <%=bindNewsClassList(0, 0, new StringBuilder())%>
   
<table class="tb" id="tbS"><tr><td>全选<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'m_id')" />反选<input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('m_id')" />
<input type="button" value="批量修改选中分类" class="btn" onclick="doPostEdit('','m_id')" id="Button1"/></td><td><input type="button" value="批量删除" onclick="doPostDeletes('','m_id')" class="btn"  style="float:right; color:Red;" /></td></tr>
</table>

<table class="tb mt20" id="insertTb">
<tr class="thead"><th colspan="8" style="height: 25px">添加分类</th></tr>	
    <tr align="left">
        <td  width="200">类别名
          <input size="13" type="text" name="m_ncname" ><font color='red'>＊</font></td>
        <td  width="162"   >别名(标签)
          <input size="10" type="text" name="m_ncTage"></td>
        <td  width="207">类别简述
          <input size="12" type="text" name="m_ncinfo"></td>
        <td width="175">
    <input type="button" value="添 加" class="btn"  onclick="doPostInsert('')"/></td>
</tr>
</table>

</div>
<uc1:adminfoot ID="Adminfoot1" runat="server" />
</form>
<script type="text/javascript">
    function  doPostDeletes(url,sname)
    {    
       
        var ids=getIDList(sname);
        if(ids!="")
        {
            if((confirm("确定要删除这些记录?"))==true)
            {
             $("#loading").show();
                url=convertURL(url+"?action=delAll&id="+ids);
//                location.href=url
                ajax_get(url,'',function(msg)
                {
                    $("#cpcontainer").empty().append(msg);
                    $("#loading").hide();
                });
	        }
	    }
	    else
	    {
	        alert("您还没有选择要删除的项");	       
	        return false;
	    }
    }
    function  doPostEdit(url,sname)
    {    
    
        var ids=getIDList(sname);
        var Param='';
        if(ids!="")
        {
            if((confirm("确定要批量修改这些记录?"))==true)
            {    $("#loading").show();
                  url=url+"?action=editAll&id="+ids; 
                  for(var i=0;i<=ids.split(',').length-1;i++)
                  { 
                     var id=ids.split(',')[i];
                     Param+= "&ncname"+id+"="+$("input[name='ncname"+id+"']").attr("value")+
                             "&ncTag"+id+"="+$("input[name='ncTag"+id+"']").attr("value")+
                             "&ncinfo"+id+"="+$("input[name='ncinfo"+id+"']").attr("value");                                 
                  }
                  
                 ajax_post(url,Param,function(msg){
                    $("#cpcontainer").empty().append(msg);
                    $("#loading").hide();
                 });
	        }
	    }
	    else
	    {
	        alert("您还没有选择要修改的项");	      
	        return;
	    }
    }
    
    function doPostInsert(url)
    { 
       
          if($("input[name=m_ncname]").attr("value")!="")
          {   $("#loading").show();
                var Datalist=''; 
                url=url+"?action=Insert&id=0";
                Datalist+= "&ncname="+$("input[name=m_ncname]").attr("value")+
                           "&ncTag="+$("input[name=m_ncTage]").attr("value")+
                           "&ncinfo="+$("input[name=m_ncinfo]").attr("value");
               ajax_post(url,Datalist,function(msg){
                $("#cpcontainer").empty().append(msg);   
                $("#loading").hide();             
               })
         }
         else
         {
            alert("类别名不能为空！");          
         }
   }  
 </script> 
</body>
</html>
